%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et

%% Vendoring deps
{project_app_dirs, ["apps/*","lib/*",".","vendor/*"]}.
{project_plugin_dirs, ["plugins/*","vendor_plugins/*"]}.

%% Duplicated from apps/rebar3:
%% - we want people who rely on rebar3 as a dependency to still be able
%%   to fetch it with git_subdir and have it work
{escript_main_app, rebar}.
{escript_name, rebar3}.
{escript_wrappers_windows, ["cmd", "powershell"]}.
{escript_comment, "%%Rebar3 3.20.0\n"}.
{escript_emu_args, "%%! +sbtu +A1\n"}.
%% escript_incl_priv is for internal rebar-private use only.
%% Do not use outside rebar. Config interface is not stable.
{escript_incl_priv, [{relx, "templates/*"},
                     {rebar, "templates/*"}]}.

{overrides, [{add, relx, [{erl_opts, [{d, 'RLX_LOG', rebar_log}]}]}]}.

{profiles, [
    %% Only works at the top-level
    {systest, [
        {erl_opts, [debug_info, nowarn_export_all]},
        {ct_opts, [{dir, "systest"}]}
    ]},
    %% Don't check these vendored deps
    {dialyzer, [
        {erl_opts, [debug_info, nowarn_export_all]},
        %% Ignore deps known to generate warnings
        {dialyzer, [{exclude_apps, [cth_readable, erlware_commons, relx]}]}
    ]},
    %% Duplicated from apps/rebar3:
    %% - we don't want the test profile applied to our vendored deps.
    %% - we want people who rely on rebar3 as a dependency to still be able
    %%   to fetch it with git_subdir and have it work
    {test, [
        {deps, [{meck, "0.8.13"}]},
        {erl_opts, [debug_info, nowarn_export_all]}
    ]},
    {prod, [
        {erl_opts, [no_debug_info]},
        {overrides, [
            {override, erlware_commons, [
                {erl_opts, [{platform_define, "^[0-9]+", namespaced_types},
                            {platform_define, "^R1[4|5]", deprecated_crypto},
                            {platform_define, "^((1[8|9])|2)", rand_module},
                            {platform_define, "^2", unicode_str},
                            {platform_define, "^(R|1|20)", fun_stacktrace},
                            no_debug_info,
                            warnings_as_errors]},
                {deps, []}, {plugins, []}]},
            {add, ssl_verify_hostname, [{erl_opts, [no_debug_info]}]},
            {add, certifi, [{erl_opts, [no_debug_info]}]},
            {add, cf, [{erl_opts, [no_debug_info]}]},
            {add, cth_readable, [{erl_opts, [no_debug_info]}]},
            {add, eunit_formatters, [{erl_opts, [no_debug_info]}]},
            {override, bbmustache, [
                {erl_opts, [no_debug_info, {platform_define, "^[0-9]+", namespaced_types}]},
                {deps, []}, {plugins, []}]},
            {add, getopt, [{erl_opts, [no_debug_info]}]},
            {add, providers, [{erl_opts, [no_debug_info]}]},
            {add, relx, [{erl_opts, [no_debug_info]}]}]}
    ]}
]}.

%% The rest of the config is in apps/rebar/
